<template>
	<view class="rich-content">
		<!-- <view v-html="content">
		</view> -->
		<u-parse :html="content"></u-parse>
		<view class="consult-box">
			<u-button type="success" shape="circle" :custom-style="customStyle"
				@click="gotoConsult">点击此处，直播咨询</u-button>
		</view>
	</view>
</template>

<script>
	import {
		getIntroduction,
		getlicense,
		getknowledge,
		getFeatures,
		getTiktoklive
	} from '../../api/live.js'
	export default {
		data() {
			return {
				customStyle: {
					background: '#2AC092',
					color: '#fff',
					type: 1,
				},
				content: ''
			}
		},
		onLoad(options) {
			this.type = options.type;
		},
		mounted() {
			switch (this.type) {
				case '1':
					uni.setNavigationBarTitle({
						title: '证照资质'
					});
					this.getlicenses();
					break;
				case '2':
					uni.setNavigationBarTitle({
						title: '平台简介'
					});
					this.getIntroduction();
					break;
				case '3':
					uni.setNavigationBarTitle({
						title: '知识付费'
					});
					this.getknowledges();
					break;
				case '4':
					uni.setNavigationBarTitle({
						title: '直播特点'
					});
					this.getFeatures();
					break;
				case '5':
					uni.setNavigationBarTitle({
						title: '抖音直播'
					});
					this.getTiktoklive();
					break;
				default:
					break;
			}
		},
		methods: {
			gotoConsult() {
				uni.navigateTo({
					url: '/pagesA/liveConsult/index'
				})
			},
			// 获取平台简介
			getIntroduction() {
				let that = this
				that.content = ''
				getIntroduction().then(res => {
					that.content = res.data.data.live_introduction_platform
				}).catch()
			},
			// 抖音直播介绍
			getTiktoklive() {
				let that = this
				that.content = ''
				getTiktoklive().then(res => {
					that.content = res.data
				}).catch()
			},
			// 直播中心-证照资质
			getlicenses() {
				let that = this
				that.content = ''
				getlicense().then(res => {
					that.content = res.data.data.live_license
				}).catch()
			},
			// 直播中心-知识付费
			getknowledges() {
				let that = this
				that.content = ''
				getknowledge().then(res => {
					that.content = res.data.data.live_pay_knowledge
				}).catch()
			},
			// 直播中心-直播特点
			getFeatures() {
				let that = this
				that.content = ''
				getFeatures().then(res => {
					that.content = res.data.data.live_streaming_features
				}).catch()
			},
		}
	}
</script>

<style lang="scss">
	.rich-content{
		padding: 0 20upx;
	}
	.consult-box {
		position: fixed;
		bottom: 0;
		background-color: #fff;
		padding: 20rpx;
		width: 100%;
	}
</style>